package nanosn.webapplication.core;

import firstSteps.HelloWorldResource;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.restlet.Client;
import org.restlet.Component;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author selkhateeb
 */
public class ApplicationComponent extends Component
{

    public ApplicationComponent()
    {
        this.getClients().add(new Client("HTTP"));
        this.getClients().add(new Client("FILE"));

        // Attach the application to the component and start it
        //Pattern p = Pattern.compile(".*/htdocs/");
        //if(p.matcher())

        this.getDefaultHost().attach(".*/htdocs/", new StaticFilesApplication());
        this.getDefaultHost().attachDefault(HelloWorldResource.class);
    }
}
